package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.entity.User;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.TechnicianZfbCountService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.voice.vo.request.AddZfbCountVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 技师支付宝账户表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-04-17 12:35:05
 */
@Api(tags = "技师支付宝相关")
@RestController
@RequestMapping("/api/technicianZfbCount")
public class TechnicianZfbCountController {
    @Resource
    private TechnicianZfbCountService technicianZfbCountService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;


    @ApiOperation("添加支付宝账户")
    @PostMapping("addTechnicianZfbCount")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<Integer> addTechnicianZfbCount(@RequestBody AddZfbCountVo requestVo)  {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianZfbCountService.addTechnicianZfbCount(technician.getId(),requestVo);
    }

    @ApiOperation("查看支付宝账户")
    @GetMapping("selectTechnicianZfbCount")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<AddZfbCountVo> selectTechnicianZfbCount()  {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianZfbCountService.selectTechnicianZfbCount(technician.getId());
    }

    @ApiOperation("查看支付宝账户")
    @PostMapping("updateTechnicianZfbCount")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<Integer> updateTechnicianZfbCount(@RequestBody AddZfbCountVo requestVo)  {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianZfbCountService.updateTechnicianZfbCount(technician.getId(),requestVo);
    }


}
